package com.swj.demo.config;

import com.swj.demo.filter.DemoFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Collections;

/**
 * write something please~
 *
 * @author huangrz
 * @since 2021/10/27
 **/
@Configuration
public class DemoConfig {

    @Bean
    public FilterRegistrationBean<DemoFilter> demoFilter() {
        FilterRegistrationBean<DemoFilter> registrationBean = new FilterRegistrationBean<DemoFilter>();
        registrationBean.setFilter(new DemoFilter());
        registrationBean.setUrlPatterns(Collections.singleton("/*"));
        registrationBean.setOrder(0);
        registrationBean.setName("demoFilter");
        return registrationBean;
    }

}
